﻿@model Kooboo.Web.Mvc.Paging.PagedList<Label>
@{
    ViewBag.Title = "Labels".Localize();
    Layout = "~/Views/Shared/Site.cshtml";
}
@section Panel{
    <ul class="panel">
        <li>
            <a href="@Url.Action("Import", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl).Merge("title", "Import labels"))">
                @Html.IconImage("import") @("Import".Localize())
            </a>
        </li>
        <li>
            <a href="@Url.Action("Export", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-command-type="Download">
                @Html.IconImage("export") @("Export".Localize())
            </a>
        </li>
         <li>
            <a id="editButton" data-show-on-check="Single">@Html.IconImage("edit") @("Edit".Localize())</a>
        </li>
        <li><a href="@Url.Action("Delete", ViewContext.RequestContext.AllRouteValues().Merge("return", ViewContext.HttpContext.Request.RawUrl))" data-show-on-check="Any" data-command-type="AjaxPost" data-confirm="@("Are you sure you want to delete these items?".Localize())">
    @Html.IconImage("delete") @("Delete".Localize())
</a></li>
        @foreach (var group in Kooboo.CMS.Sites.Extension.UI.TopToolbar.ToolbarButtons.GetToolbarButtons(ViewContext.RequestContext))
        {
            @Html.Partial("_ToolbarGroupButtons", group)
        }
    </ul>
}

<div class="topbar clearfix">
    <h1 class="title left">
        @ViewBag.Title</h1>
    @Html.Partial("_Search")
</div>

@Html.GridForModel2(m => m)

<div class="pagination right">
    @Html.Pager(Model, "", ViewContext.RequestContext.AllRouteValues(), null)
</div>
<script>
    $(function () {
        var $table = $('.common-table table');        
        $table.checkableTable();
        $table.mixedGrid();
        $table.gridInlineEdit();
        $('textarea').autosize();

        $('#editButton').click(function () {
            var $selected = $table.find("tbody tr input:checkbox[checked]");
            var $td = $selected.closest('td').next().next();
            $td.find('.display-template').addClass('hide');
            $td.find('.edit-template').removeClass('hide');
        });
    });

</script>
